package cn.edu.lzzy.dao;

import cn.edu.lzzy.entities.Course;
import cn.edu.lzzy.entities.User;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;


import java.util.List;
import java.util.UUID;
import java.util.concurrent.CountDownLatch;

public interface CourseRepository extends JpaRepository<Course, UUID> {
    //获取课程信息
    List<Course> findAllByOrderByUpdateTimeDesc();

    //获取分压课程信息
    List<Course> findAllByOrderByUpdateTimeDesc(Pageable pageable);

    //获取课程记录数
    Integer countAllBy();

    //获取某个教师创建的课程信息
    List<Course> findCourseByTeacherIdEqualOrderByCreateTime(UUID id);

    //获取某个学生注册的课程
    List<Course> findCourseByStudentsContainsAAndOpenOrderByUpdateTime(UUID student,boolean isOpen);

    // 需要todo：开放&关闭课程
    User findCourseByOrderByUpdateIsOpen(UUID id);//根据用户名/密码查找用户

}
